#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include "StdTcp.h"
#include "StdThread.h"
#include "clientadmin.h"

#define true 1
#define false 0

void main(int argc,char *argv[])
{
    

    if(argc!=3)
    {
        printf("invalid numbers\n");
        return;
    }
    TcpC *c=InitTcpClinet(argv[1],atoi(argv[2]));
    Msg m;
    while(1)
    {
        if(ClientUserLoginRegistration(c,&m)==true)
        {
            break;
        }
    }
    Admin admin;
    admin.serial=m.serial;
    strcpy(admin.myname,m.myname);
    strcpy(admin.password,m.password);
    admin.mynameid=m.mynameid;
    printf("%s %d\n",admin.myname,admin.mynameid);
    TcpClinetSend(c,&m,sizeof(Msg));
    Interface(c,&m,&admin);
}